package com.yuwubao.hz_International.controllers.app

import com.yuwubao.hz_International.entities.vo.MoneyVo
import com.yuwubao.hz_International.services.AppService
import com.yuwubao.hz_International.util.RestApiResponse
import org.springframework.data.domain.Page
import org.springframework.web.bind.annotation.*
import javax.annotation.Resource

@RestController
@RequestMapping("money")
@CrossOrigin
class MoneyApi {
    @Resource private lateinit var appService: AppService;

    @GetMapping("getMoneyList")
    fun getMoneyList(@RequestParam(required = false,defaultValue = "")name:String,
                     @RequestParam(required = false,defaultValue = "")start:String,
                     @RequestParam(required = false,defaultValue = "")end:String,
                     @RequestParam(required = false,defaultValue = "1")index:Int,
                     @RequestParam(required = false,defaultValue = "0")type:Int,
                     @RequestParam(required = false,defaultValue = "10")size:Int): RestApiResponse<Any> {
        val result = RestApiResponse<Any>()
        val vo:Page<MoneyVo> = appService.getMoneyList(name,start,end,index,size,type)
        result.successResponse(vo)
        return result
    }

    @GetMapping("demo")
    fun demo(){
        appService.updateName()
    }
}